<template>
    <div id="header">
        <el-checkbox v-model="checkedAll" size="large" />
        <!-- <input type="checkbox" v-model="checkedAll"> -->
    </div>
</template>

<script setup>
import { ref, computed } from 'vue'
import emitter from '../eventBus.js'
const datas = ref([])
// 接受datas数据
emitter.on('datasContent', (data) => {
    datas.value = data.value || data
})

const checkedAll = computed({
    get() {
        return datas.value.every(item => item.isChecked) && datas.value.length > 0
    },
    set(status) {
        datas.value.map((data) => {
            data.isChecked = status
        })
    }
})
</script>